using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Arcadium.Graphics;
using Microsoft.Xna.Framework;

namespace Arcadium.Screens.Menus.Sidebar
{
    public enum TextVerticalAlignment
    {
        Top = 0, Middle, Bottom
    };

    class SidebarMenuEntry : SidebarComponent
    {
        #region Field

        private TextVerticalAlignment alignment;

        #endregion

        #region Properties

        public string Text { get; set; }

        public Vector2 Position { get; set; }

        #endregion

        #region Initialization

        public SidebarMenuEntry(string text, Vector2 startPosition) :
            this(text, startPosition, TextVerticalAlignment.Top) { }

        public SidebarMenuEntry(string text, Vector2 startPosition, TextVerticalAlignment alignment)
        {
            this.Text = text;
            this.Position = startPosition;
            this.alignment = alignment;
        }

        #endregion

        public void Draw(SpriteBatch spriteBatch, bool sidebarHasFocus)
        {
            if (Visible)
            {
                spriteBatch.DrawString(ViewResource.MenuFont, Text, View.Adjust(Position),
                IsSelected && sidebarHasFocus ? Color.Red : Color.White, 0,
                new Vector2(0, ViewResource.MenuFont.LineSpacing * ((int)alignment / 2f)), View.ScreenScale,
                SpriteEffects.None, LockedFocus ? 0 : .5f);
            }
        }

    }
}
